<template>
	<view class="all_lotteries">
		<uni-nav-bar fixed status-bar :border="false" left-icon="left" title="中奖记录" @clickLeft="back" />
		<!-- <view class="tabs">
			<view :class="{ active: type == '1' }" @click="selectEvt('1')">兑奖码列表</view>
			<view :class="{ active: type == '2' }" @click="selectEvt('2')">我的奖品</view>

		</view> -->
		<view class="content" :style="{height:`calc(100vh - ${navHeight}rpx - 60rpx)`}">
			<!-- 	<CodeList :taskId="id" v-if="type == '1'" /> -->
			<RewordList :taskId="id" />
		</view>
	</view>
</template>
<script>
	import CodeList from './CodeList.vue'
	import RewordList from './RewordList.vue'
	import {
		systemInfo
	} from '@/mixin/globalData.js'
	// status 已发布 4 已借su 0 daifabu
	// type 1 jichoujikai  2 dingshikaijiang 3满人开奖
	const type1 = {
		1: '已发布',
		0: '待发布',
		4: '已结束'
	}
	const type2 = {
		1: '即抽即开',
		2: '定时开奖',
		3: '满人开奖'
	}
	export default {
		data() {
			return {
				type1,
				type2,
				taskList: [{
					id: 1,
					name: '123123'
				}],
				type: '2',
				page: 1,
				num: 10,
				showMore: true,
				id: 0
			}
		},
		mixins: [systemInfo],
		components: {
			CodeList,
			RewordList
		},
		methods: {
			back() {
				uni.navigateBack();
			},
			getTaskList() {
				const {
					page,
					num,
					type
				} = this;
				uni.$http.get('/user/public/allTaskIndex', {
					page,
					num,
					type
				}).then(res => {
					if (res.data.data.list.length) {
						this.taskList.push(...res.data.data.list);
					} else {
						this.showMore = false;
					}
				})
			},
			selectEvt(value) {
				this.type = value;
				this.page = '1';
				this.taskList = [];
				this.showMore = true;
				//   this.getTaskList();
			},
			loadMore() {
				this.page++;
				this.getTaskList();
			},
			jumpPage(value) {
				uni.setStorageSync('task_info', value);
				uni.navigateTo({
					url: '/pagesMy/myPrize/index'
				})
			}
		},
		onLoad(options) {
			console.log("this.id")
			this.type = options.type ? options.type : "1";
			this.id = options.id
			console.log(this.id)
			// this.getTaskList();
			this.getSystemInfo()
			console.log('navHeight:', this.navHeight)
		},
		// created(){
		// // #ifndef H5 || APP-PLUS || MP-ALIPAY
		// let menuButtonObject = uni.getMenuButtonBoundingClientRect(); //获取菜单按钮（右上角胶囊按钮）的布局位置信息。坐标信息以屏幕左上角为原点。
		// uni.getSystemInfo({ //获取系统信息
		// 	success: res => {
		// 		//导航栏高度=菜单按钮高度+（菜单按钮与顶部距离-状态栏高度）*2
		// 		let navHeight = menuButtonObject.height + (menuButtonObject.top - res.statusBarHeight) * 2;
		// 		// 导航栏（胶囊）高度
		// 		this.titleBarHeight = Number(parseInt(navHeight / (uni.upx2px(100) / 100))) + 'rpx';
		// 		//  状态栏（顶部）高度
		// 		this.statusBarHeight = Number(parseInt(res.statusBarHeight / (uni.upx2px(100) / 100))) +
		// 			'rpx';
		// 		console.log(this.statusBarHeight, this.titleBarHeight, '顶部高度，药丸高度');
		// 		let total = Number(navHeight + res.statusBarHeight) / (uni.upx2px(100) / 100);
		// 		// rpx内置转换 = xxx(px)/(uni.upx2px(100) / 100)
		// 		this.totalHeight = Number(parseInt(total)) + 'rpx';
		// 	},
		// 	fail(err) {
		// 		console.log(err);
		// 	}
		// })
		// // #endif
		// },
	}
</script>
<style lang="scss" scoped>
	.all_lotteries {
		height: 100vh;
		overflow-y: hidden;

		.tabs {
			display: flex;
			flex-wrap: nowrap;
			justify-content: space-around;
			background-color: #fff;
			font-size: 30rpx;
			padding: 10rpx 20rpx 0;
			height: 56rpx;

			.active {
				font-weight: bold;

				&::after {
					content: '';
					display: block;
					width: 50rpx;
					height: 6rpx;
					background-color: #000;
					margin-left: 50%;
					margin-top: 15rpx;
					transform: translateX(-50%);

				}
			}
		}

		.content {
			padding: 20rpx;
			box-sizing: border-box;
		}
	}
</style>